Sql |
SELECT distinct a.style_id,
case a.style_id
when 122869 then 1
when 20007 then 2
when 73680 then 3
when 20014 then 4
when 248901 then 5
when 202261 then 6
when 50261 then 7
when 299137 then 8
when 106172 then 9
when 309572 then 10
when 297375 then 11
when 79054 then 12
when 102011 then 13
when 7544 then 14
when 22929 then 15
when 22935 then 16
when 16411 then 17
when 276300 then 18
when 22933 then 19
when 204024 then 20
when 290092 then 21
when 189403 then 22
when 248902 then 23
when 300562 then 24
when 38441 then 25
when 144002 then 26
when 276301 then 27
when 38446 then 28
when 144001 then 29
when 317777 then 30
when 264125 then 31
when 150620 then 32
when 123917 then 33
when 296754 then 34
when 323387 then 35
when 228597 then 36
when 255658 then 37
when 263463 then 38
when 263453 then 39
when 263462 then 40
when 281268 then 41
when 250639 then 42
when 198110 then 43
when 205395 then 44
when 263464 then 45
when 20002 then 46
when 282995 then 47
when 16408 then 48
when 248903 then 49
when 202873 then 50
when 264685 then 51
when 264686 then 52
when 250643 then 53
when 151735 then 54
when 204112 then 55
when 282994 then 56
when 204113 then 57
when 300570 then 58
when 23919 then 59
when 189404 then 60
when 116810 then 61
when 141727 then 62
when 203431 then 63
when 203925 then 64
when 117366 then 65
when 143155 then 66
when 44752 then 67
when 300564 then 68
when 202874 then 69
when 263455 then 70
when 232206 then 71
when 147929 then 72
when 184358 then 73
when 263466 then 74
when 263459 then 75
when 292829 then 76
when 300560 then 77
when 151737 then 78
when 151738 then 79
when 159150 then 80
when 277443 then 81
when 206720 then 82
when 212894 then 83
when 279875 then 84
when 277680 then 85
when 276729 then 86
when 133765 then 87
when 215534 then 88
when 276730 then 89
when 151585 then 90
when 107665 then 91
when 85097 then 92
when 302159 then 93
when 206515 then 94
when 302160 then 95
when 206516 then 96
when 286666 then 97
when 290088 then 98
when 256224 then 99
when 290091 then 100
when 290085 then 101
when 290089 then 102
when 320707 then 103
when 320710 then 104
when 252417 then 105
when 297587 then 106
when 205975 then 107
when 250056 then 108
when 163556 then 109
when 272643 then 110
when 214267 then 111
when 280350 then 112
when 208948 then 113
when 134636 then 114
when 168479 then 115
when 202872 then 116
when 202871 then 117
when 283514 then 118
when 290087 then 119
when 307931 then 120
when 307932 then 121
when 307930 then 122
when 283510 then 123
when 293549 then 124
when 212896 then 125
when 225255 then 126
when 250427 then 127
when 285205 then 128
when 48786 then 129
when 317633 then 130
when 283505 then 131
when 283511 then 132
when 114322 then 133
when 106999 then 134
when 225252 then 135
when 225250 then 136
when 225254 then 137
when 283818 then 138
when 298834 then 139
when 311240 then 140
when 283504 then 141
when 283506 then 142
when 296827 then 143
when 304795 then 144
when 319954 then 145
when 85328 then 146
when 182508 then 147
when 189835 then 148
when 189836 then 149
when 77853 then 150
when 53930 then 151
when 283819 then 152
when 283503 then 153
when 283508 then 154
when 283509 then 155
when 283512 then 156
when 289617 then 157
when 290002 then 158
when 311239 then 159
when 113766 then 160
when 53925 then 161
when 53933 then 162
when 220890 then 163
when 293227 then 164
when 53929 then 165
when 67732 then 166
when 128633 then 167
when 293234 then 168
when 293229 then 169
when 308066 then 170
when 53934 then 171
when 126525 then 172
when 193120 then 173
when 193115 then 174
when 193117 then 175
when 220892 then 176
when 104468 then 177
when 293228 then 178
when 289618 then 179
when 301141 then 180
when 193113 then 181
when 293233 then 182
when 222574 then 183
when 263458 then 184
when 293226 then 185
when 279980 then 186
when 285197 then 187
when 299055 then 188
when 101307 then 189
when 7517 then 190
when 173848 then 191
when 108208 then 192
when 198109 then 193
when 22921 then 194
when 248900 then 195
when 168477 then 196
when 263460 then 197
when 305051 then 198
when 301710 then 199
when 301709 then 200
when 151734 then 201
when 292991 then 202
when 320787 then 203
when 303588 then 204
when 305049 then 205
when 305055 then 206
when 305059 then 207
when 124381 then 208
when 144003 then 209
when 134569 then 210
when 266040 then 211
when 262259 then 212
when 320500 then 213
when 151117 then 214
when 206517 then 215
when 270873 then 216
when 266703 then 217
when 263819 then 218
when 126950 then 219
when 138359 then 220
when 196068 then 221
when 210292 then 222
when 214894 then 223
when 215619 then 224
when 221074 then 225
when 255698 then 226
when 269510 then 227
when 320029 then 228
when 126951 then 229
when 138364 then 230
when 161190 then 231
when 188283 then 232
when 189292 then 233
when 191585 then 234
when 193477 then 235
when 193478 then 236
when 257017 then 237
when 318197 then 238
when 114073 then 239
when 189019 then 240
when 189166 then 241
when 206320 then 242
when 206983 then 243
when 263465 then 244
when 263461 then 245
when 266965 then 246
when 147928 then 247
when 164348 then 248
when 168476 then 249
when 189649 then 250
when 198108 then 251
when 206321 then 252
when 249639 then 253
when 263456 then 254
when 263454 then 255
when 168475 then 256
when 196818 then 257
when 208894 then 258
when 35057 then 259
when 111160 then 260
when 13055 then 261
when 113777 then 262
when 113776 then 263
when 80785 then 264
when 291722 then 265
when 81717 then 266
when 151736 then 267
when 249640 then 268
when 251455 then 269
when 93752 then 270
when 74223 then 271
when 123666 then 272
when 149111 then 273
when 13056 then 274
when 268058 then 275
when 108713 then 276
when 110828 then 277
when 188661 then 278
when 53992 then 279
when 71371 then 280
when 209208 then 281
when 48837 then 282
when 134428 then 283
when 201633 then 284
when 168036 then 285
when 164012 then 286
when 205221 then 287
when 268301 then 288
when 212895 then 289
when 251459 then 290
when 157849 then 291
when 192460 then 292
when 213465 then 293
when 80049 then 294
when 39643 then 295
when 283066 then 296
when 245236 then 297
when 269940 then 298
when 245832 then 299
when 262342 then 300
when 279872 then 301
when 205079 then 302
when 44708 then 303
when 260937 then 304
when 81094 then 305
when 202207 then 306
when 266383 then 307
when 266122 then 308
when 260939 then 309
when 303608 then 310
when 20013 then 311
when 81719 then 312
when 123196 then 313
when 192429 then 314
when 197954 then 315
when 74350 then 316
when 39150 then 317
when 287714 then 318
when 58218 then 319
when 117262 then 320
when 280359 then 321
when 94742 then 322
when 94745 then 323
when 58225 then 324
when 123192 then 325
when 58245 then 326
when 302623 then 327
when 302622 then 328
when 268059 then 329
when 58425 then 330
when 212098 then 331
when 263816 then 332
when 268109 then 333
when 303609 then 334
when 124256 then 335
when 269950 then 336
when 172326 then 337
when 152705 then 338
when 197955 then 339
when 76683 then 340
when 131299 then 341
when 319043 then 342
when 188660 then 343
when 225362 then 344
when 58029 then 345
when 40320 then 346
when 277845 then 347
when 7040 then 348
when 51528 then 349
when 86798 then 350
when 11026 then 351
when 20012 then 352
when 287854 then 353
when 311537 then 354
when 297132 then 355
when 320595 then 356
when 331205 then 357
when 260412 then 358
when 127122 then 359
when 40359 then 360
when 136019 then 361
when 6502 then 362
when 199226 then 363
when 274064 then 364
when 298117 then 365
when 329458 then 366
when 44751 then 367
when 72901 then 368
when 51485 then 369
when 190023 then 370
when 263680 then 371
when 245757 then 372
when 289030 then 373
when 39680 then 374
when 297133 then 375
when 288544 then 376
when 137255 then 377
when 10955 then 378
when 195829 then 379
when 205017 then 380
when 51494 then 381
when 51495 then 382
when 273364 then 383
when 273366 then 384
when 101835 then 385
when 127126 then 386
when 127101 then 387
when 198750 then 388
when 202784 then 389
when 138332 then 390
when 188340 then 391
when 245408 then 392
when 225672 then 393
when 254161 then 394
when 117101 then 395
when 7340 then 396
when 72900 then 397
when 99621 then 398
when 290473 then 399
when 127123 then 400
when 298503 then 401
when 323253 then 402
when 29546 then 403
when 201544 then 404
when 191503 then 405
when 193766 then 406
when 208272 then 407
when 263916 then 408
when 10960 then 409
when 127125 then 410
when 277390 then 411
when 205222 then 412
when 44768 then 413
when 196785 then 414
when 51486 then 415
when 68542 then 416
when 277031 then 417
when 196500 then 418
when 167651 then 419
when 40127 then 420
when 161919 then 421
when 293251 then 422
when 320498 then 423
when 320499 then 424
when 130241 then 425
when 130365 then 426
when 121914 then 427
when 150696 then 428
when 120943 then 429
when 169096 then 430
when 184467 then 431
when 197108 then 432
when 53956 then 433
when 205220 then 434
when 207535 then 435
when 220567 then 436
when 101456 then 437
when 253987 then 438
when 164331 then 439
when 203532 then 440
when 13054 then 441
when 127100 then 442
when 127124 then 443
when 127099 then 444
when 161921 then 445
when 306678 then 446
when 319008 then 447
when 317903 then 448
when 319098 then 449
when 320930 then 450
when 75149 then 451
when 161441 then 452
when 170373 then 453
when 197510 then 454
when 113522 then 455
when 79854 then 456
when 215985 then 457
when 210595 then 458
when 225694 then 459
when 254162 then 460
when 266384 then 461
when 16410 then 462
when 320009 then 463
when 320011 then 464
when 317631 then 465
when 29547 then 466
when 136081 then 467
when 194286 then 468
when 188748 then 469
when 206959 then 470
when 207336 then 471
when 263001 then 472
when 53951 then 473
when 284314 then 474
when 293240 then 475
when 307411 then 476
when 330474 then 477
when 157874 then 478
when 193164 then 479
when 53913 then 480
when 201640 then 481
when 205654 then 482
when 205219 then 483
when 205647 then 484
when 216706 then 485
when 227193 then 486
when 51478 then 487
when 245426 then 488
when 151608 then 489
when 293239 then 490
when 293244 then 491
when 293208 then 492
when 320028 then 493
when 330466 then 494
when 193584 then 495
when 121157 then 496
when 201641 then 497
when 205653 then 498
when 51501 then 499
when 124425 then 500
when 7339 then 501
when 211337 then 502
when 293254 then 503
when 293204 then 504
when 307412 then 505
when 308143 then 506
when 301944 then 507
when 323227 then 508
when 323228 then 509
when 155690 then 510
when 176013 then 511
when 202366 then 512
when 214791 then 513
when 220570 then 514
when 227194 then 515
when 246215 then 516
when 246217 then 517
when 247175 then 518
when 263688 then 519
when 253743 then 520
when 264030 then 521
when 281080 then 522
when 273805 then 523
when 71275 then 524
when 293238 then 525
when 293247 then 526
when 296834 then 527
when 298076 then 528
when 286751 then 529
when 330377 then 530
when 330473 then 531
when 169055 then 532
when 203247 then 533
when 220569 then 534
when 220568 then 535
when 251733 then 536
when 247477 then 537
when 253738 then 538
when 264176 then 539
when 123189 then 540
when 293245 then 541
when 293258 then 542
when 293237 then 543
when 293248 then 544
when 296835 then 545
when 301812 then 546
when 302340 then 547
when 308145 then 548
when 308146 then 549
when 319998 then 550
when 323545 then 551
when 330321 then 552
when 293000 then 553
when 176014 then 554
when 202482 then 555
when 121990 then 556
when 53936 then 557
when 118189 then 558
when 274099 then 559
when 278917 then 560
when 281719 then 561
when 257276 then 562
when 264177 then 563
when 302337 then 564
when 281594 then 565
when 320504 then 566
when 323822 then 567
when 133187 then 568
when 48935 then 569
when 208657 then 570
when 222232 then 571
when 255563 then 572
when 254201 then 573
when 277842 then 574
when 225759 then 575
when 250231 then 576
when 260926 then 577
when 266671 then 578
when 266677 then 579
when 269839 then 580
when 277030 then 581
when 272145 then 582
when 257274 then 583
when 290155 then 584
when 129558 then 585
when 61815 then 586
when 61812 then 587
when 61804 then 588
when 61805 then 589
when 256908 then 590
when 297600 then 591
when 257278 then 592
when 172862 then 593
when 206166 then 594
when 168871 then 595
when 181362 then 596
when 163307 then 597
when 212027 then 598
when 214465 then 599
when 215557 then 600
when 167736 then 601
when 88483 then 602
when 172651 then 603
when 61808 then 604
when 61810 then 605
when 12888 then 606
when 116735 then 607
when 172649 then 608
when 172696 then 609
when 196786 then 610
when 142883 then 611
when 218564 then 612
when 262404 then 613
when 294628 then 614
when 31932 then 615
when 170313 then 616
when 205580 then 617
when 172650 then 618
when 167737 then 619
when 294644 then 620
when 294624 then 621
when 294625 then 622
when 294626 then 623
when 295106 then 624
when 299330 then 625
when 188282 then 626
when 195462 then 627
when 164479 then 628
when 208332 then 629
when 215902 then 630
when 218479 then 631
when 220218 then 632
when 249638 then 633
when 124925 then 634
when 161837 then 635
when 179230 then 636
when 107196 then 637
when 65291 then 638
when 205190 then 639
when 206272 then 640
when 331095 then 641
when 331094 then 642
when 307784 then 643
when 161940 then 644
when 39334 then 645
when 61811 then 646
when 262593 then 647
when 61814 then 648
when 61809 then 649
when 61807 then 650
when 278911 then 651
when 134696 then 652
when 264696 then 653
when 290575 then 654
when 317825 then 655
when 326638 then 656
when 61299 then 657
when 19178 then 658
when 136211 then 659
when 92767 then 660
when 31933 then 661
when 156111 then 662
when 143768 then 663
when 203499 then 664
when 207043 then 665
when 144956 then 666
when 210616 then 667
when 217371 then 668
when 254155 then 669
when 218565 then 670
when 294623 then 671
when 301166 then 672
when 169754 then 673
when 288063 then 674
when 28027 then 675
when 289489 then 676
when 326287 then 677
when 326289 then 678
when 294629 then 679
when 294631 then 680
when 301168 then 681
when 48731 then 682
when 48729 then 683
when 104501 then 684
when 61296 then 685
when 73431 then 686
when 143957 then 687
when 92765 then 688
when 65290 then 689
when 23549 then 690
when 179413 then 691
when 208202 then 692
when 204267 then 693
when 216567 then 694
when 216542 then 695
when 254567 then 696
when 116923 then 697
when 261838 then 698
when 264073 then 699
when 297792 then 700
when 301383 then 701
when 307980 then 702
when 129869 then 703
when 122511 then 704
when 148137 then 705
when 260690 then 706
when 280180 then 707
when 285925 then 708
when 285876 then 709
when 288122 then 710
when 309589 then 711
when 206663 then 712
when 171987 then 713
when 217327 then 714
when 128458 then 715
when 285403 then 716
when 286306 then 717
when 290846 then 718
when 294934 then 719
when 296463 then 720
when 296607 then 721
when 203515 then 722
when 301169 then 723
when 316695 then 724
when 326285 then 725
when 326291 then 726
when 316546 then 727
when 153353 then 728
when 294630 then 729
when 19192 then 730
when 125640 then 731
when 91482 then 732
when 161128 then 733
when 164083 then 734
when 133413 then 735
when 172052 then 736
when 165521 then 737
when 181952 then 738
when 209804 then 739
when 210617 then 740
when 72706 then 741
when 220679 then 742
when 260628 then 743
when 252528 then 744
when 104416 then 745
when 296428 then 746
when 301165 then 747
when 309573 then 748
when 188281 then 749
when 192470 then 750
when 192163 then 751
when 193914 then 752
when 207486 then 753
when 208203 then 754
when 215899 then 755
when 255697 then 756
when 267213 then 757
when 272640 then 758
when 144126 then 759
when 118436 then 760
when 122206 then 761
when 134495 then 762
when 118476 then 763
when 228594 then 764
when 242401 then 765
when 122915 then 766
when 122758 then 767
when 326125 then 768
when 50118 then 769
when 122481 then 770
when 24192 then 771
when 171986 then 772
when 61367 then 773
when 122917 then 774
when 285390 then 775
when 309581 then 776
when 310223 then 777
when 310670 then 778
when 310667 then 779
when 310668 then 780
when 310669 then 781
when 48730 then 782
when 61158 then 783
when 61161 then 784
when 101907 then 785
when 48736 then 786
when 179372 then 787
when 161090 then 788
when 202772 then 789
when 61837 then 790
when 205399 then 791
when 208919 then 792
when 250494 then 793
when 251197 then 794
when 263096 then 795
when 263095 then 796
when 121206 then 797
when 267389 then 798
when 268722 then 799
when 272534 then 800
when 275750 then 801
when 278984 then 802
when 270382 then 803
when 164589 then 804
when 250497 then 805
when 208918 then 806
when 141238 then 807
when 320023 then 808
when 122482 then 809
when 114414 then 810
when 148099 then 811
when 245407 then 812
when 122759 then 813
when 260689 then 814
when 261214 then 815
when 287982 then 816
when 307797 then 817
when 310676 then 818
when 325339 then 819
when 281324 then 820
when 290615 then 821
when 290589 then 822
when 64019 then 823
when 48735 then 824
when 171990 then 825
when 218240 then 826
when 94100 then 827
when 264296 then 828
when 287996 then 829
when 28040 then 830
when 294873 then 831
when 298941 then 832
when 310690 then 833
when 310677 then 834
when 310675 then 835
when 310698 then 836
when 310682 then 837
when 310697 then 838
when 310674 then 839
when 310696 then 840
when 310694 then 841
when 310687 then 842
when 310684 then 843
when 310672 then 844
when 310673 then 845
when 310678 then 846
when 310695 then 847
when 324740 then 848
when 61162 then 849
when 61163 then 850
when 61474 then 851
when 61979 then 852
when 170067 then 853
when 162575 then 854
when 179371 then 855
when 179374 then 856
when 179373 then 857
when 188474 then 858
when 189445 then 859
when 208193 then 860
when 61476 then 861
when 218049 then 862
when 263583 then 863
when 150286 then 864
when 193654 then 865
when 292147 then 866
when 320021 then 867
when 328553 then 868
when 61929 then 869
when 250230 then 870
when 92435 then 871
when 183688 then 872
when 101627 then 873
when 220058 then 874
when 6315 then 875
when 228590 then 876
when 242371 then 877
when 175449 then 878
when 281366 then 879
when 289321 then 880
when 257009 then 881
when 50107 then 882
when 123535 then 883
when 19410 then 884
when 147232 then 885
when 196205 then 886
when 161435 then 887
when 222599 then 888
when 251745 then 889
when 19412 then 890
when 252769 then 891
when 268729 then 892
when 290145 then 893
when 309554 then 894
when 323335 then 895
when 290610 then 896
when 290646 then 897
when 41528 then 898
when 90903 then 899
when 144257 then 900
when 116913 then 901
when 181833 then 902
when 181823 then 903
when 184314 then 904
when 184315 then 905
when 220086 then 906
when 107587 then 907
when 48991 then 908
when 255121 then 909
when 126476 then 910
when 260811 then 911
when 268263 then 912
when 283364 then 913
when 285941 then 914
when 291881 then 915
when 306894 then 916
when 325315 then 917
when 131889 then 918
when 205376 then 919
when 263685 then 920
when 184448 then 921
when 193475 then 922
when 193613 then 923
when 211031 then 924
when 214810 then 925
when 215638 then 926
when 217372 then 927
when 226059 then 928
when 255696 then 929
when 122144 then 930
when 179484 then 931
when 179486 then 932
when 179491 then 933
when 129969 then 934
when 191743 then 935
when 204597 then 936
when 228042 then 937
when 185607 then 938
when 252873 then 939
when 250495 then 940
when 264520 then 941
when 268721 then 942
when 266771 then 943
when 273318 then 944
when 286957 then 945
when 323740 then 946
when 40368 then 947
when 220090 then 948
when 220091 then 949
when 285848 then 950
when 251875 then 951
when 91741 then 952
when 131560 then 953
when 105763 then 954
when 117386 then 955
when 137486 then 956
when 148322 then 957
when 203384 then 958
when 210188 then 959
when 106863 then 960
when 269273 then 961
when 289970 then 962
when 298940 then 963
when 252768 then 964
when 330958 then 965
when 137018 then 966
when 19446 then 967
when 161434 then 968
when 208363 then 969
when 228040 then 970
when 233345 then 971
when 161897 then 972
when 205114 then 973
when 205110 then 974
when 44632 then 975
when 64687 then 976
when 276069 then 977
when 19444 then 978
when 227175 then 979
when 264519 then 980
when 267115 then 981
when 269099 then 982
when 48732 then 983
when 123769 then 984
when 129144 then 985
when 48996 then 986
when 48995 then 987
when 144258 then 988
when 102524 then 989
when 110321 then 990
when 98522 then 991
when 175669 then 992
when 175668 then 993
when 189726 then 994
when 216029 then 995
when 280168 then 996
when 76721 then 997
when 299336 then 998
when 189090 then 999
when 143656 then 1000
else 1000
end as ranking,
max(a.non_invt) as non_invt,sum(qoh + qc) as available,max(a.dept) as dept,max(a.brand) as brand,max(a.of3) as of3,case when sum(qoh + qc) > 0 then 1 else 0 end as instock
FROM web_all_products a WITH (NOLOCK)
INNER JOIN dbo.tb_skus b WITH (NOLOCK) ON (a.style_id = b.style_id)
INNER JOIN dbo.tb_sku_buckets c WITH (NOLOCK) ON (b.sku_id = c.sku_id and c.store_id in (10,32))
INNER JOIN dbo.tb_styles_web_taxonomy d WITH (NOLOCK) ON (a.style_id = d.style)
INNER JOIN dbo.tb_styles qq WITH (NOLOCK) ON (qq.style_id = a.style_id)
where a.style_id in (122869,20007,73680,20014,248901,202261,50261,299137,106172,309572,297375,79054,102011,7544,22929,22935,16411,276300,22933,204024,290092,189403,248902,300562,38441,144002,276301,38446,144001,317777,264125,150620,123917,296754,323387,228597,255658,263463,263453,263462,281268,250639,198110,205395,263464,20002,282995,16408,248903,202873,264685,264686,250643,151735,204112,282994,204113,300570,23919,189404,116810,141727,203431,203925,117366,143155,44752,300564,202874,263455,232206,147929,184358,263466,263459,292829,300560,151737,151738,159150,277443,206720,212894,279875,277680,276729,133765,215534,276730,151585,107665,85097,302159,206515,302160,206516,286666,290088,256224,290091,290085,290089,320707,320710,252417,297587,205975,250056,163556,272643,214267,280350,208948,134636,168479,202872,202871,283514,290087,307931,307932,307930,283510,293549,212896,225255,250427,285205,48786,317633,283505,283511,114322,106999,225252,225250,225254,283818,298834,311240,283504,283506,296827,304795,319954,85328,182508,189835,189836,77853,53930,283819,283503,283508,283509,283512,289617,290002,311239,113766,53925,53933,220890,293227,53929,67732,128633,293234,293229,308066,53934,126525,193120,193115,193117,220892,104468,293228,289618,301141,193113,293233,222574,263458,293226,279980,285197,299055,101307,7517,173848,108208,198109,22921,248900,168477,263460,305051,301710,301709,151734,292991,320787,303588,305049,305055,305059,124381,144003,134569,266040,262259,320500,151117,206517,270873,266703,263819,126950,138359,196068,210292,214894,215619,221074,255698,269510,320029,126951,138364,161190,188283,189292,191585,193477,193478,257017,318197,114073,189019,189166,206320,206983,263465,263461,266965,147928,164348,168476,189649,198108,206321,249639,263456,263454,168475,196818,208894,35057,111160,13055,113777,113776,80785,291722,81717,151736,249640,251455,93752,74223,123666,149111,13056,268058,108713,110828,188661,53992,71371,209208,48837,134428,201633,168036,164012,205221,268301,212895,251459,157849,192460,213465,80049,39643,283066,245236,269940,245832,262342,279872,205079,44708,260937,81094,202207,266383,266122,260939,303608,20013,81719,123196,192429,197954,74350,39150,287714,58218,117262,280359,94742,94745,58225,123192,58245,302623,302622,268059,58425,212098,263816,268109,303609,124256,269950,172326,152705,197955,76683,131299,319043,188660,225362,58029,40320,277845,7040,51528,86798,11026,20012,287854,311537,297132,320595,331205,260412,127122,40359,136019,6502,199226,274064,298117,329458,44751,72901,51485,190023,263680,245757,289030,39680,297133,288544,137255,10955,195829,205017,51494,51495,273364,273366,101835,127126,127101,198750,202784,138332,188340,245408,225672,254161,117101,7340,72900,99621,290473,127123,298503,323253,29546,201544,191503,193766,208272,263916,10960,127125,277390,205222,44768,196785,51486,68542,277031,196500,167651,40127,161919,293251,320498,320499,130241,130365,121914,150696,120943,169096,184467,197108,53956,205220,207535,220567,101456,253987,164331,203532,13054,127100,127124,127099,161921,306678,319008,317903,319098,320930,75149,161441,170373,197510,113522,79854,215985,210595,225694,254162,266384,16410,320009,320011,317631,29547,136081,194286,188748,206959,207336,263001,53951,284314,293240,307411,330474,157874,193164,53913,201640,205654,205219,205647,216706,227193,51478,245426,151608,293239,293244,293208,320028,330466,193584,121157,201641,205653,51501,124425,7339,211337,293254,293204,307412,308143,301944,323227,323228,155690,176013,202366,214791,220570,227194,246215,246217,247175,263688,253743,264030,281080,273805,71275,293238,293247,296834,298076,286751,330377,330473,169055,203247,220569,220568,251733,247477,253738,264176,123189,293245,293258,293237,293248,296835,301812,302340,308145,308146,319998,323545,330321,293000,176014,202482,121990,53936,118189,274099,278917,281719,257276,264177,302337,281594,320504,323822,133187,48935,208657,222232,255563,254201,277842,225759,250231,260926,266671,266677,269839,277030,272145,257274,290155,129558,61815,61812,61804,61805,256908,297600,257278,172862,206166,168871,181362,163307,212027,214465,215557,167736,88483,172651,61808,61810,12888,116735,172649,172696,196786,142883,218564,262404,294628,31932,170313,205580,172650,167737,294644,294624,294625,294626,295106,299330,188282,195462,164479,208332,215902,218479,220218,249638,124925,161837,179230,107196,65291,205190,206272,331095,331094,307784,161940,39334,61811,262593,61814,61809,61807,278911,134696,264696,290575,317825,326638,61299,19178,136211,92767,31933,156111,143768,203499,207043,144956,210616,217371,254155,218565,294623,301166,169754,288063,28027,289489,326287,326289,294629,294631,301168,48731,48729,104501,61296,73431,143957,92765,65290,23549,179413,208202,204267,216567,216542,254567,116923,261838,264073,297792,301383,307980,129869,122511,148137,260690,280180,285925,285876,288122,309589,206663,171987,217327,128458,285403,286306,290846,294934,296463,296607,203515,301169,316695,326285,326291,316546,153353,294630,19192,125640,91482,161128,164083,133413,172052,165521,181952,209804,210617,72706,220679,260628,252528,104416,296428,301165,309573,188281,192470,192163,193914,207486,208203,215899,255697,267213,272640,144126,118436,122206,134495,118476,228594,242401,122915,122758,326125,50118,122481,24192,171986,61367,122917,285390,309581,310223,310670,310667,310668,310669,48730,61158,61161,101907,48736,179372,161090,202772,61837,205399,208919,250494,251197,263096,263095,121206,267389,268722,272534,275750,278984,270382,164589,250497,208918,141238,320023,122482,114414,148099,245407,122759,260689,261214,287982,307797,310676,325339,281324,290615,290589,64019,48735,171990,218240,94100,264296,287996,28040,294873,298941,310690,310677,310675,310698,310682,310697,310674,310696,310694,310687,310684,310672,310673,310678,310695,324740,61162,61163,61474,61979,170067,162575,179371,179374,179373,188474,189445,208193,61476,218049,263583,150286,193654,292147,320021,328553,61929,250230,92435,183688,101627,220058,6315,228590,242371,175449,281366,289321,257009,50107,123535,19410,147232,196205,161435,222599,251745,19412,252769,268729,290145,309554,323335,290610,290646,41528,90903,144257,116913,181833,181823,184314,184315,220086,107587,48991,255121,126476,260811,268263,283364,285941,291881,306894,325315,131889,205376,263685,184448,193475,193613,211031,214810,215638,217372,226059,255696,122144,179484,179486,179491,129969,191743,204597,228042,185607,252873,250495,264520,268721,266771,273318,286957,323740,40368,220090,220091,285848,251875,91741,131560,105763,117386,137486,148322,203384,210188,106863,269273,289970,298940,252768,330958,137018,19446,161434,208363,228040,233345,161897,205114,205110,44632,64687,276069,19444,227175,264519,267115,269099,48732,123769,129144,48996,48995,144258,102524,110321,98522,175669,175668,189726,216029,280168,76721,299336,189090,143656)
and ltrim(rtrim(lower(a.brand))) = 'ruger'
and a.of3='45 COLT AND 454 CASULL'
group by a.style_id
order by instock desc, ranking asc
|